<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../vue.js"></script>
</head>

<body>

  <div id="app">

    <h1 v-style:font-size.100px.red>gp18</h1>

    <div v-demo="{username:'hanye',age:20}"></div>

  </div>


  <script>


    Vue.directive('style', {
      inserted(el, options) {
        console.log('options:', options)
        let [fontsize, color] = Object.keys(options.modifiers);
        el.style[options.arg] = fontsize;
        el.style.color = color;
      }
    })

    Vue.directive('demo', function (el, binding) {
      console.log("binding:", binding)
    })

    var vm = new Vue({
      el: "#app",
      data: {
        username: 'hanye',
        age: 20
      }
    })


  </script>

</body>

</html>